package com.iflytek.yly.jetpackdemo.databinding;

import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;

import com.iflytek.yly.jetpackdemo.BR;
import com.iflytek.yly.jetpackdemo.R;

public class SimpleTextViewDemo5Activity extends AppCompatActivity {

    ActivityDatabindingDemo5Binding activityDatabindingDemo5Binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        activityDatabindingDemo5Binding =
                DataBindingUtil.setContentView(this,R.layout.activity_databinding_demo5);


        activityDatabindingDemo5Binding.setVariable(BR.networkImage,"http://bpic.588ku.com/element_origin_min_pic/19/03/15/75076c485081d15ed9c224ad3e4ce4a1.jpg");
        activityDatabindingDemo5Binding.setVariable(BR.localImage,R.mipmap.ic_launcher);

        //旧值
        activityDatabindingDemo5Binding.setImagePadding(40);
        activityDatabindingDemo5Binding.setClickHandler(new ClickHandler());

    }

    public class ClickHandler{
        public void onClick(View view){
            //新值
            activityDatabindingDemo5Binding.setImagePadding(180);
        }
    }
}